import request from '../utils/request';

export const adminlogin = form => {
    return request.post('/Login/login',form);
};

export const storelogin = form => {
    return request.post('/Login/storelogin',form);
};

export const getIndexNumber = query => {
    return request({
        url: '/index/getNumber',
        method: 'get'
    })
};
export const getStoreIdByName = query => {
    return request({
        url: '/index/getStoreIdByName',
        method: 'get',
        params: query
    })
};

// 用户管理
export const getUsers = query => {
    return request({
        url: '/User/getUsers',
        method: 'get'
    });
};

export const editUser = query => {
    return request({
        url: '/User/editUser',
        method: 'post',
        data: query
    });
};

export const delUser = query => {
    return request({
        url: '/User/delUser',
        method: 'post',
        params: query
    });
};

// 商品管理
export const getGood = query => {
    return request({
        url: '/Good/getGood',
        method: 'post',
        data: query
    });
};

export const getGoodByCategory = query => {
    return request({
        url: '/Good/getGoodById',
        method: 'get',
        params: query
    });
};
export const getGoodByName = query => {
    return request({
        url: '/Good/getGoodByName',
        method: 'get',
        params: query
    });
};
export const updGood = query => {
    return request({
        url: '/Good/updGood',
        method: 'get',
        params: query
    });
};



export const getGoodPicByCategory = query => {
    return request({
        url: '/Good/getGoodPicById',
        method: 'get',
        params: query
    });
};
export const getGoodPicByName = query => {
    return request({
        url: '/Good/getGoodPicByName',
        method: 'get',
        params: query
    });
};


export const getSugFoot = query => { return request.post('/Suggest/getSugFoot',query)};


export const getSugBig = kind => { return request({
    url:'/Suggest/getSugBig',
    method: 'get',
    params: {kind :kind}
    })
};
export const delSuggBig = query => {return request.post('/Suggest/delSugBig',query);};

export const pushSuggBig = (id,kind) => {
    return request({
        url: '/Suggest/pushSuggBig',
        method: 'get',
        params: { goodid:id,kind:kind}
    });
};





export const pushGood = query => { return request.post('/Good/pushGood',query)};

export const pushSuggFoot = query => { return request.post('/Suggest/pushSuggFoot',query)};

export const updSuggFoot = query => { return request.post('/Suggest/updSuggFoot',query)};

export const delSuggFoot = query => {
    return request.post('/Suggest/delSuggFoot',query);
};


export const takeDownGood = query => {
    return request.post('/Good/takeDownGood',query);
};

export const takeUpGood = query => {
    return request.post('/Good/takeUpGood',query);
};

export const delGood = query => {
    return request.post('/Good/delGood',query);
};
export const delMulGood = query => {
    return request.post('/Good/delMulGood',query);
};


export const getGoodPic = query => {
      return request({
        url: '/Good/getGoodPic',
        method: 'post',
        data: query
      });
};

export const updGoodPic = query => {
    return request.post('/Good/updGoodPic',query
    );
};

export const getGoodCate = query => {
    return request({
        url: '/category/getCategory',
        method: 'get',
        params: query
    });
};

export const updateGoodCate = form => {
    return request.post('/category/updateCategory',form);
};

// report
export const getReportData = query => {
    return request({
        url: '/report/getMonthReport',
        method: 'get'
    });
}
//月报表
export const getReportDataByMonth = query => {
    return request({
        url: '/report/getReportDataByMonth',
        method: 'get',
        params: query
    });
}

export const getReportDataByMonthPay = query => {
    return request({
        url: '/report/getReportDataByMonthPay',
        method: 'get',
        params: query
    });
}

export const getReportDataByMonthCancel = query => {
    return request({
        url: '/report/getReportDataByMonthCancel',
        method: 'get',
        params: query
    });
}

export const getReportDataByMonthPIE = query => {
    return request({
        url: '/report/getReportDataByMonthPIE',
        method: 'get',
        params: query
    });
}
// 季度报表
export const getReportDataByQuarter = query => {
    return request({
        url: '/report/getReportDataByQuarter',
        method: 'get',
        params: query
    });
}

export const getReportDataByQuarterPay = query => {
    return request({
        url: '/report/getReportDataByQuarterPay',
        method: 'get',
        params: query
    });
}

export const getReportDataByQuarterCancel= query => {
    return request({
        url: '/report/getReportDataByQuarterCancel',
        method: 'get',
        params: query
    });
}

export const getReportDataByQuarterPIE= query => {
    return request({
        url: '/report/getReportDataByQuarterPIE',
        method: 'get',
        params: query
    });
}

//年报表
export const getReportDataByYear = query => {
    return request({
        url: '/report/getReportDataByYear',
        method: 'get',
        params: query
    });
}

export const getReportDataByYearPay = query => {
    return request({
        url: '/report/getReportDataByYearPay',
        method: 'get',
        params: query
    });
}

export const getReportDataByYearCancel = query => {
    return request({
        url: '/report/getReportDataByYearCancel',
        method: 'get',
        params: query
    });
}

export const getReportDataByYearPIE = query => {
    return request({
        url: '/report/getReportDataByYearPIE',
        method: 'get',
        params: query
    });
}

//用户订单
export const getOrders = query => {
    return request.post('/order/getOrders',query);
}

export const editOrderStatusById = query => {
    return request({
        url: '/order/editOrderStatusById',
        method: 'post',
        params: query
    });
}

//售后订单
export const getServiceOrderByStoreId = query => {
    return request({
        url: '/serviceOrder/getServiceOrderByStoreId',
        method: 'get',
        params: query
    });
}

export const getServiceOrder = query => {
    return request({
        url: '/serviceOrder/getServiceOrder',
        method: 'get',
        params: query
    });
}

export const getServiceOrderByStatusAndStoreId = query => {
    return request({
        url: '/serviceOrder/getServiceOrderByStatusAndStoreId',
        method: 'get',
        params: query
    });
}

export const getServiceOrderAll = query => {
    return request({
        url: '/serviceOrder/getServiceOrder',
        method: 'get',
        params: query
    });
}

export const updateServiceOrderById = query => {
    return request({
        url: '/serviceOrder/updateServiceOrderById',
        method: 'get',
        params: query
    });
}

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};

//小法庭
export const getTribunalList = query => {
    return request({
        url: '/tribunal/getMyTribunalByStoreId',
        method: 'get',
        params: query
    });
};

